package com.CmJava.tomcat.Server.service.container;

import com.CmJava.tomcat.Server.Component;
import com.CmJava.tomcat.Server.life.Lifecycle;
import com.CmJava.tomcat.Server.life.LifecycleState;

public class Engine implements Lifecycle, Component {
    private LifecycleState lifecycleState=LifecycleState.NEW;

    private Component child;


    public Engine(Component child) {
        this.child = child;
    }

    public Component getChild() {
        return child;
    }

    public void setChild(Component child) {
        this.child = child;
    }

    @Override
    public void init() {
        Host host = new Host(null);
        host.init();
        child=host;
        lifecycleState=LifecycleState.INITIALIZED;
    }

    @Override
    public void start() {
        Host host = (Host) child;
        host.start();
    }

    @Override
    public void stop() {

    }

    @Override
    public void destroy() {

    }

    @Override
    public LifecycleState getState() {
        return null;
    }
}
